<template>
  <el-form :model="formData" label-width="80px">
    <el-form-item label="城市">
      <el-input v-model="formData.city"></el-input>
    </el-form-item>
    <el-form-item label="图片">
      <el-input v-model="formData.img"></el-input>
    </el-form-item>
    <el-form-item label="时间">
      <el-date-picker
        v-model="formData.date"
        type="date"
        placeholder="选择日期"
      ></el-date-picker>
    </el-form-item>
    <el-form-item>
      <el-button @click="submitForm">提交</el-button>
    </el-form-item>
  </el-form>
</template>

<script>
export default {
  data() {
    return {
      formData: {
        id: '',
        date: '',
        img: '',
        city: '',
      },
    }
  },
  created() {
    console.log('编辑数据:', this.$attrs.formData, 'formDerae')
    if (this.$attrs.formData) {
      this.formData = this.$attrs.formData
    }
  },
  methods: {
    submitForm() {
      // 添加 // 编辑
      console.log(this.formData, '提交数据')
      console.log(this, '----------')
      this.$listeners.click(this.formData)
    },
  },
}
</script>

<style></style>
